import datetime

from sqlalchemy import func
from sqlalchemy.orm import Mapped, mapped_column

from src.infrastructure.db.models.base import Base


class Statistics(Base):
    __tablename__ = "stats"
    __mapper_args__ = {"eager_defaults": True}

    id: Mapped[int] = mapped_column(primary_key=True)
    day: Mapped[datetime.datetime] = mapped_column(unique=True, server_default=func.now())
    mobile_proxies_bought: Mapped[int] = mapped_column(server_default="0")
    server_proxies_bought: Mapped[int] = mapped_column(server_default="0")
    payments_payed: Mapped[int] = mapped_column(server_default="0")
    messages_sent: Mapped[int] = mapped_column(server_default="0")
    subscriptions: Mapped[int] = mapped_column(server_default="0")
    vpns: Mapped[int] = mapped_column(server_default="0")

    def __repr__(self):
        return f"<Stats №{self.id} {self.day}>"
